/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.product.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
import queenb.net.entitybean.S100;
import queenb.net.entitybean.S400;
import queenb.web.controller.QueenbController;
import queenb.web.product.store.S100Store;
import queenb.web.product.store.S400Store;
import queenb.web.util.ComboboxUtil;
import queenb.web.util.ContextUtil;
import queenb.web.util.SessionProvider;
import queenb.web.util.Util;

/**
 *
 * @author Nguyen Hung
 */
public class productController extends QueenbController {

    private S100Store s100Store;
    private S400Store s400Store;
    private List<S100> listS100;
    private List<S400> listS400;
    private int fs400 = 0;
    private int ps100 = 0;
    private int pnSDATE;
    private int pnSMONT;
    private int pnSYEAR;
    private int pnFA000F = 373;
    private int pnFA000T;
    private int pnSN204;
    private String pvSV201;
    private Date pdSD202;
    private String pvSV203;
    private String pvSV205;
    private int pnSN206 = 1;
    private int pnSN207;
    private int pnSN208;
    private int pnSN101;
    private int pnSN102 = 9;
    private int pnSN103 = 30;
    private int pnSN104 = 1;
    private int pnSN105;
    private int pnSN106;
    private int pnSN107;
    private int pnCN108 = 9;
    private int pnCN109 = 30;
    private String pvSV110 = "TBA";
    private ComboboxUtil cbxUtil;
    private List<SelectItem> cbxA000F;
    private List<SelectItem> cbxA000T;
    private List<SelectItem> cbxA000TTP = new ArrayList<SelectItem>();// get label 
    private Date repeat_date = new Date();
    private String bContructor;
    private String messageform;
//    private String option; // +getter +setter
//    private List<SelectItem> options; // +getter
    private List<SelectItem> listday = new ArrayList<SelectItem>();
    private int selectid;
    private List<SelectItem> listdayedit = new ArrayList<SelectItem>();
    private int vn079;
    private int n750;
    private int idcountry;// chuyen doi TP
    private List<SelectItem> combN750 = new ArrayList<SelectItem>();
    private List<SelectItem> combN750TP = new ArrayList<SelectItem>();

    public productController() {
        s100Store = new S100Store();
        s400Store = new S400Store();
        cbxUtil = new ComboboxUtil();
        System.out.println("productController");
        try {
            if (getRequest().getParameter("action") != null) {
                String action = getRequest().getParameter("action").toString();
                if (action.equals("addS100")) {
                    SessionProvider.setSessionMapValue("vn079", null);
                    Object objFS400 = getRequest().getParameter("fs400");
                    if (objFS400 != null) {
                        fs400 = Integer.parseInt(objFS400.toString());
                    }
                    Object objPS100 = getRequest().getParameter("ps100");
                    if (objPS100 != null) {
                        ps100 = Integer.parseInt(objPS100.toString());
                    }
                    Object objSN101 = getRequest().getParameter("sn101");
                    if (objSN101 != null) {
                        pnSN101 = Integer.parseInt(objSN101.toString());
                    }
                    Object objSN102 = getRequest().getParameter("sn102");
                    if (objSN102 != null) {
                        pnSN102 = Integer.parseInt(objSN102.toString());
                    }
                    Object objSN103 = getRequest().getParameter("sn103");
                    if (objSN103 != null) {
                        pnSN103 = Integer.parseInt(objSN103.toString());
                    }
                    Object objSN104 = getRequest().getParameter("sn104");
                    if (objSN104 != null) {
                        pnSN104 = Integer.parseInt(objSN104.toString());
                    }
                    Object objDate = getRequest().getParameter("date");
                    if (objDate != null && pnSN104 == 0) {
                        repeat_date = Util.parseDate(objDate.toString(), "dd/MM/yyyy");
                        pnSN105 = repeat_date.getYear();
                        pnSN106 = repeat_date.getMonth();
                        pnSN107 = repeat_date.getDate();
                    } else if (objDate != null && pnSN104 == 2) {
                        repeat_date = Util.parseDate(objDate.toString(), "dd/MM/yyyy");
                        pnSN105 = repeat_date.getYear();
                        pnSN106 = repeat_date.getMonth();
                        pnSN107 = repeat_date.getDate();
                    } else {
                        repeat_date = null;
                    }
                    Object objCN108 = getRequest().getParameter("sn108");
                    if (objCN108 != null) {
                        pnCN108 = Integer.parseInt(objCN108.toString());
                    }
                    Object objCN109 = getRequest().getParameter("sn109");
                    if (objCN109 != null) {
                        pnCN109 = Integer.parseInt(objCN109.toString());
                    }
                    Object objSV110 = getRequest().getParameter("sv110");
                    if (objSV110 != null) {
                        pvSV110 = objSV110.toString();
                    }
                    updateS100();

                } else if (action.equals("detailS100")) {
                    Object objPS400 = getRequest().getParameter("ps400");
                    System.out.println("action detailS100--" + objPS400);
                    if (objPS400 != null) {
                        fs400 = Integer.parseInt(objPS400.toString());
                    }
                } else if (action.equals("editS400")) {
                    Object objPS400 = getRequest().getParameter("ps400");
                    System.out.println("action detailS100--" + objPS400);
                    if (objPS400 != null) {
                        fs400 = Integer.parseInt(objPS400.toString());
                        editS400(fs400);
                    }

                } else if (action.equals("S100Edit")) {
                    Object obj = getRequest().getParameter("editAction");
                    System.out.println("action editAction--:" + obj);
                    if (obj != null) {
                        selectid = Integer.parseInt(obj.toString());
                        SessionProvider.setSessionMapValue("selectidS100", selectid);
                    }

                }
            }

            // multi level in combobox diem khoi hanh - diem den
//            options = new ArrayList<SelectItem>();
//
//            SelectItemGroup group1 = new SelectItemGroup("Group 1");
//            group1.setSelectItems(new SelectItem[]{
//                        new SelectItem("Group 1 Value 1", "Group 1 Label 1"),
//                        new SelectItem("Group 1 Value 2", "Group 1 Label 2"),
//                        new SelectItem("Group 1 Value 3", "Group 1 Label 3")
//                    });
//            options.add(group1);
//
//            SelectItemGroup group2 = new SelectItemGroup("Group 2");
//            group2.setSelectItems(new SelectItem[]{
//                        new SelectItem("Group 2 Value 1", "Group 2 Label 1"),
//                        new SelectItem("Group 2 Value 2", "Group 2 Label 2"),
//                        new SelectItem("Group 2 Value 3", "Group 2 Label 3")
//                    });
//            options.add(group2);

        } catch (Exception e) {
        }
    }

    private void editS400(int ps400) {
        try {
            List<S400> lstS400 = s400Store.LISTOFTABS400DE(getLogin().getModule(), getLogin().getCompanyNo(), ps400, getLogin().getUserName());
            if (lstS400 != null && lstS400.size() > 0) {
                S400 s400 = lstS400.get(0);
                pvSV201 = s400.getSv401();
                pnFA000F = s400.getFa000f();
                pnFA000T = s400.getFa000t();
                pnSN204 = s400.getSn404();
                pnSN206 = s400.getSn406();
                pnSN207 = s400.getSn407();
                pnSN208 = s400.getSn408();
                pvSV205 = s400.getSv405();
                vn079 = s400.getVn079();
                SessionProvider.setSessionMapValue("vn079", vn079);
            }
        } catch (Exception e) {
        }

    }

    public void updateS400(ActionEvent ev) {
        int rs = 0;

        try {
            if (!pvSV201.equals("") && pnSN206 != 0) {
                System.out.println("INSERTTABS200--:" + getLogin().getModule() + "','" + getLogin().getCompanyNo() + "','" + pnFA000F + "','" + pnFA000T + "','" + fs400
                        + "','" + pvSV201 + "','" + Util.toSQLDate(pdSD202) + "','" + pvSV203 + "','" + pnSN204 + "','" + pvSV205 + "','" + pnSN206 + "','" + pnSN207 + "','" + pnSN208 + "','" + vn079 + "','" + getLogin().getUserName());
                rs = s400Store.INSERTTABS400SGT(getLogin().getModule(), getLogin().getCompanyNo(), pnFA000F, pnFA000T, fs400, pvSV201, Util.toSQLDate(pdSD202), pvSV203, pnSN204, pvSV205, pnSN206, pnSN207, pnSN208, vn079, getLogin().getUserName());
                System.out.println("updateS200 rs --" + rs);
                if (rs > 0) {
                    // setMessageform("Cập nhật thành công !");
                    sendRedirectUrlTab("createProduct.jsp");
                    showGlobalReport(true, getResourceString("datasavesuccessful"));

                } else {
                    sendRedirectUrlTab("createProduct.jsp");
                    showGlobalReport(true, getResourceString("datasuccessfail"));
                }
//        sendRedirect("createProduct.jsp");
            }else if(pnSN206 == 0) {
                setMessageform("Số ngày lớn hơn 0!");
            } else {
                setMessageform("(*) Không được bỏ trống!");
            }
        } catch (Exception e) {
            System.out.println("updateS200 error --" + e.getMessage());
            rs = -1;
        }



    }

    public void changetarget(ActionEvent ac) {
        System.out.println("D:---change changetarget " + vn079);
        SessionProvider.setSessionMapValue("vn079", vn079);
    }

    public void updateS100() {
        int rs = 0;
        try {
//            int flag = Integer.parseInt(ContextUtil.getRequestParameter("flag"));
//            if (flag == 0) {
//                repeat_date = Util.parseDate(ContextUtil.getRequestParameter("dateRepeat"), "dd/MM/yyyy");
//                pnSN101 = Integer.parseInt(ContextUtil.getRequestParameter("sn101"));
//                pnSN102 = Integer.parseInt(ContextUtil.getRequestParameter("sn102"));
//                pnSN103 = Integer.parseInt(ContextUtil.getRequestParameter("sn103"));
//                pnSN104 = Integer.parseInt(ContextUtil.getRequestParameter("sn104"));
//                pnSN105 = Integer.parseInt(ContextUtil.getRequestParameter("sn105"));
//                pnSN106 = Integer.parseInt(ContextUtil.getRequestParameter("sn106"));
//                pnSN107 = Integer.parseInt(ContextUtil.getRequestParameter("sn107"));
//                pnCN108 = Integer.parseInt(ContextUtil.getRequestParameter("sn108"));
//                pnCN109 = Integer.parseInt(ContextUtil.getRequestParameter("sn109"));
//                ps100 = Integer.parseInt(ContextUtil.getRequestParameter("ps100"));
//                pvSV110 = ContextUtil.getRequestParameter("sv110");
//            }
            System.out.println("INSERTTABS100 repeat_date--" + repeat_date);
            if (repeat_date != null) {
                pnSN105 = repeat_date.getYear() + 1900;
                pnSN106 = repeat_date.getMonth() + 1;
                pnSN107 = repeat_date.getDate();
            } else {
                pnSN105 = 0;
                pnSN106 = 0;
                pnSN107 = 0;
            }
            System.out.println("INSERTTABS100" + ps100 + "','" + getLogin().getModule() + "','"
                    + getLogin().getCompanyNo() + "','"
                    + fs400 + "','"
                    + pnSN101 + "','"
                    + pnSN102 + "','"
                    + pnSN103 + "','"
                    + pnSN104 + "','"
                    + pnSN105 + "','"
                    + pnSN106 + "','"
                    + pnSN107 + "','"
                    + pnCN108 + "','"
                    + pnCN109 + "','" + pvSV110 + "','" + getLogin().getUserName());
            rs = s100Store.INSERTTABS100(ps100, getLogin().getModule(),
                    getLogin().getCompanyNo(),
                    fs400,
                    pnSN101,
                    pnSN102,
                    pnSN103,
                    pnSN104,
                    pnSN105,
                    pnSN106,
                    pnSN107,
                    pnCN108,
                    pnCN109, pvSV110, getLogin().getUserName());


        } catch (Exception e) {
            System.out.println("updateS100 error --" + e.getMessage());
            rs = -1;
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }
        System.out.println("updateS200 rs --" + rs);
        if (rs > 0) {
            showGlobalReport(true, getResourceString("datasavesuccessful"));

        } else {
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }
        sendRedirect("createProduct.jsp?tab=s100" + fs400);
    }

    /**
     * @return the listS100
     */
    public List<S100> getListS100() {
        try {
            System.out.println("LISTOFTABS100--:" + fs400);
            listS100 = s100Store.LISTOFTABS100(getLogin().getModule(), getLogin().getCompanyNo(), fs400, getLogin().getUserName());
            System.out.println("LISTOFTABS100--:" + listS100.size());
        } catch (Exception e) {
            listS100 = new ArrayList<S100>();
        }
        return listS100;
    }

    /**
     * @param listS100 the listS100 to set
     */
    public void setListS100(List<S100> listS100) {
        this.listS100 = listS100;
    }

    /**
     * @return the listS200
     */
    public List<S400> getListS400() {
        try {
//            System.out.println("LISTOFTABS400--:" + "','" + getLogin().getModule() + "','" + getLogin().getCompanyNo() + "','" + fs400 + "','" + pnSDATE + "','" + pnSMONT + "','" + pnSYEAR + "','" + pnFA000F + "','" + pnFA000T + "','" + pnSN204 + "','" + getLogin().getUserName());
//            listS400 = s400Store.LISTOFTABS400(getLogin().getModule(), getLogin().getCompanyNo(), fs400, pnSDATE, pnSMONT, pnSYEAR, pnFA000F, pnFA000T, pnSN204, getLogin().getUserName());

            listS400 = s400Store.LISTOFTABS400DE(getLogin().getModule(), getLogin().getCompanyNo(), 0, getLogin().getUserName());
            System.out.println("getListS400--:" + listS400.size());
        } catch (Exception e) {
            listS400 = new ArrayList<S400>();
        }
        return listS400;
    }

    /**
     * @param listS200 the listS200 to set
     */
    public void setListS400(List<S400> listS400) {
        this.listS400 = listS400;
    }

    /**
     * @return the fs200
     */
    public int getFs400() {
        return fs400;
    }

    /**
     * @param fs200 the fs200 to set
     */
    public void setFs400(int fs400) {
        this.fs400 = fs400;
    }

    /**
     * @return the pnSDATE
     */
    public int getPnSDATE() {
        return pnSDATE;
    }

    /**
     * @param pnSDATE the pnSDATE to set
     */
    public void setPnSDATE(int pnSDATE) {
        this.pnSDATE = pnSDATE;
    }

    /**
     * @return the pnSMONT
     */
    public int getPnSMONT() {
        return pnSMONT;
    }

    /**
     * @param pnSMONT the pnSMONT to set
     */
    public void setPnSMONT(int pnSMONT) {
        this.pnSMONT = pnSMONT;
    }

    /**
     * @return the pnSYEAR
     */
    public int getPnSYEAR() {
        return pnSYEAR;
    }

    /**
     * @param pnSYEAR the pnSYEAR to set
     */
    public void setPnSYEAR(int pnSYEAR) {
        this.pnSYEAR = pnSYEAR;
    }

    /**
     * @return the pnFA000F
     */
    public int getPnFA000F() {
        return pnFA000F;
    }

    /**
     * @param pnFA000F the pnFA000F to set
     */
    public void setPnFA000F(int pnFA000F) {
        this.pnFA000F = pnFA000F;
    }

    /**
     * @return the pnFA000T
     */
    public int getPnFA000T() {
        return pnFA000T;
    }

    /**
     * @param pnFA000T the pnFA000T to set
     */
    public void setPnFA000T(int pnFA000T) {
        this.pnFA000T = pnFA000T;
    }

    /**
     * @return the pnSN204
     */
    public int getPnSN204() {
        return pnSN204;
    }

    /**
     * @param pnSN204 the pnSN204 to set
     */
    public void setPnSN204(int pnSN204) {
        this.pnSN204 = pnSN204;
    }

    /**
     * @return the pvSV201
     */
    public String getPvSV201() {
        return pvSV201;
    }

    /**
     * @param pvSV201 the pvSV201 to set
     */
    public void setPvSV201(String pvSV201) {
        this.pvSV201 = pvSV201;
    }

    /**
     * @return the pdSD202
     */
    public Date getPdSD202() {
        return pdSD202;
    }

    /**
     * @param pdSD202 the pdSD202 to set
     */
    public void setPdSD202(Date pdSD202) {
        this.pdSD202 = pdSD202;
    }

    /**
     * @return the pvSV203
     */
    public String getPvSV203() {
        return pvSV203;
    }

    /**
     * @param pvSV203 the pvSV203 to set
     */
    public void setPvSV203(String pvSV203) {
        this.pvSV203 = pvSV203;
    }

    /**
     * @return the pvSV205
     */
    public String getPvSV205() {
        return pvSV205;
    }

    /**
     * @param pvSV205 the pvSV205 to set
     */
    public void setPvSV205(String pvSV205) {
        this.pvSV205 = pvSV205;
    }

    /**
     * @return the pnSN206
     */
    public int getPnSN206() {
        return pnSN206;
    }

    /**
     * @param pnSN206 the pnSN206 to set
     */
    public void setPnSN206(int pnSN206) {
        this.pnSN206 = pnSN206;
    }

    /**
     * @return the pnSN207
     */
    public int getPnSN207() {
        return pnSN207;
    }

    /**
     * @param pnSN207 the pnSN207 to set
     */
    public void setPnSN207(int pnSN207) {
        this.pnSN207 = pnSN207;
    }

    /**
     * @return the pnSN208
     */
    public int getPnSN208() {
        return pnSN208;
    }

    /**
     * @param pnSN208 the pnSN208 to set
     */
    public void setPnSN208(int pnSN208) {
        this.pnSN208 = pnSN208;
    }

    /**
     * @return the ps100
     */
    public int getPs100() {
        return ps100;
    }

    /**
     * @param ps100 the ps100 to set
     */
    public void setPs100(int ps100) {
        this.ps100 = ps100;
    }

    /**
     * @return the pnSN101
     */
    public int getPnSN101() {
        return pnSN101;
    }

    /**
     * @param pnSN101 the pnSN101 to set
     */
    public void setPnSN101(int pnSN101) {
        this.pnSN101 = pnSN101;
    }

    /**
     * @return the pnSN102
     */
    public int getPnSN102() {
        return pnSN102;
    }

    /**
     * @param pnSN102 the pnSN102 to set
     */
    public void setPnSN102(int pnSN102) {
        this.pnSN102 = pnSN102;
    }

    /**
     * @return the pnSN103
     */
    public int getPnSN103() {
        return pnSN103;
    }

    /**
     * @param pnSN103 the pnSN103 to set
     */
    public void setPnSN103(int pnSN103) {
        this.pnSN103 = pnSN103;
    }

    /**
     * @return the pnSN104
     */
    public int getPnSN104() {
        return pnSN104;
    }

    /**
     * @param pnSN104 the pnSN104 to set
     */
    public void setPnSN104(int pnSN104) {
        this.pnSN104 = pnSN104;
    }

    /**
     * @return the pnSN105
     */
    public int getPnSN105() {
        return pnSN105;
    }

    /**
     * @param pnSN105 the pnSN105 to set
     */
    public void setPnSN105(int pnSN105) {
        this.pnSN105 = pnSN105;
    }

    /**
     * @return the pnSN106
     */
    public int getPnSN106() {
        return pnSN106;
    }

    /**
     * @param pnSN106 the pnSN106 to set
     */
    public void setPnSN106(int pnSN106) {
        this.pnSN106 = pnSN106;
    }

    /**
     * @return the pnSN107
     */
    public int getPnSN107() {
        return pnSN107;
    }

    /**
     * @param pnSN107 the pnSN107 to set
     */
    public void setPnSN107(int pnSN107) {
        this.pnSN107 = pnSN107;
    }

    /**
     * @return the pnCN108
     */
    public int getPnCN108() {
        return pnCN108;
    }

    /**
     * @param pnCN108 the pnCN108 to set
     */
    public void setPnCN108(int pnCN108) {
        this.pnCN108 = pnCN108;
    }

    /**
     * @return the pnCN109
     */
    public int getPnCN109() {
        return pnCN109;
    }

    /**
     * @param pnCN109 the pnCN109 to set
     */
    public void setPnCN109(int pnCN109) {
        this.pnCN109 = pnCN109;
    }

    /**
     * @return the pvSV110
     */
    public String getPvSV110() {
        return pvSV110;
    }

    /**
     * @param pvSV110 the pvSV110 to set
     */
    public void setPvSV110(String pvSV110) {
        this.pvSV110 = pvSV110;
    }

    /**
     * @return the cbxA000F
     */
    public List<SelectItem> getCbxA000F() {
        try {
            cbxA000F = cbxUtil.getListCombA000_SP(0);
        } catch (Exception e) {
            cbxA000F = new ArrayList<SelectItem>();
        }
        return cbxA000F;
    }

    /**
     * @param cbxA000F the cbxA000F to set
     */
    public void setCbxA000F(List<SelectItem> cbxA000F) {
        this.cbxA000F = cbxA000F;
    }

    /**
     * @return the cbxA000T
     */
    public List<SelectItem> getCbxA000T() {
        try {
            int flag = 0;
            System.out.println("D:- Pham vi tour: " + vn079);
            Object obj = SessionProvider.getSessionMapValue("vn079");
            if (obj != null) {
                System.out.println("D:- Pham vi tour session:" + SessionProvider.getSessionMapValue("vn079").toString());
                try {
                    flag = Integer.parseInt(obj.toString());
                } catch (Exception e) {
                }
            }

            if (flag == 0) {
                cbxA000T = cbxUtil.getListCombA000_SP(1);
            } else {
                Object objn750 = SessionProvider.getSessionMapValue("n750Pro");
                if (objn750 != null) {
                    System.out.println("D:- objn750 : " + objn750);
                    int a = 0;
                    try {
                        a = Integer.parseInt(objn750.toString());
                    } catch (Exception e) {
                    }
                    cbxA000T = cbxUtil.getListCombA000DV(a);
                } else {
                    cbxA000T = cbxUtil.getListCombA000DV(0);
                }

            }

        } catch (Exception e) {
            cbxA000T = new ArrayList<SelectItem>();
        }

        return cbxA000T;
    }

    /**
     * @param cbxA000T the cbxA000T to set
     */
    public void setCbxA000T(List<SelectItem> cbxA000T) {
        this.cbxA000T = cbxA000T;
    }

    /**
     * @return the repeat_date
     */
    public Date getRepeat_date() {
        return repeat_date;
    }

    /**
     * @param repeat_date the repeat_date to set
     */
    public void setRepeat_date(Date repeat_date) {
        this.repeat_date = repeat_date;
    }

    /**
     * @return the bContructor
     */
    public String getbContructor() {
        return bContructor;
    }

    /**
     * @param bContructor the bContructor to set
     */
    public void setbContructor(String bContructor) {
        this.bContructor = bContructor;
    }

    /**
     * @return the messageform
     */
    public String getMessageform() {
        return messageform;
    }

    /**
     * @param messageform the messageform to set
     */
    public void setMessageform(String messageform) {
        this.messageform = messageform;
    }

    public void changeCountry(ActionEvent ac) {
        System.out.println("D:---change Country " + n750);
        SessionProvider.setSessionMapValue("n750Pro", n750);

    }

    public void changeCountryTP(ActionEvent ac) {
        System.out.println("TUNG:---change Country " + idcountry);
        SessionProvider.setSessionMapValue("n750ProTP", idcountry);

    }

    /**
     * @return the combN750
     */
    public List<SelectItem> getCombN750() {


        combN750 = new ArrayList<SelectItem>();
        int f = 0;
        System.out.println("D:- vn079: " + vn079);
        Object obj = SessionProvider.getSessionMapValue("vn079");
        if (obj != null) {
            System.out.println("D:- vn079ss" + obj.toString());
            try {
                f = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }
        }

        if (f == 0) {
            SelectItem item = new SelectItem("1", "Viet Nam");
            combN750.add(item);
        } else {
            ComboboxUtil combo = new ComboboxUtil();
            combN750 = combo.getlistCombN750DVT();
        }
        SessionProvider.setSessionMapValue("n750Pro", combN750.get(0));
        return combN750;
    }

    /**
     * @param combN750 the combN750 to set
     */
    public void setCombN750(List<SelectItem> combN750) {
        this.combN750 = combN750;
    }

    /**
     * @return the listday
     */
    public List<SelectItem> getListday() {
        List<SelectItem> list = new ArrayList<SelectItem>();
        SelectItem t2 = new SelectItem("2", "Thứ Hai");
        list.add(t2);
        SelectItem t3 = new SelectItem("3", "Thứ Ba");
        list.add(t3);
        SelectItem t4 = new SelectItem("4", "Thứ Tư");
        list.add(t4);
        SelectItem t5 = new SelectItem("5", "Thứ Năm");
        list.add(t5);
        SelectItem t6 = new SelectItem("6", "Thứ Sáu");
        list.add(t6);
        SelectItem t7 = new SelectItem("7", "Thứ Bảy");
        list.add(t7);
        SelectItem cn = new SelectItem("1", "Chủ nhật");
        list.add(cn);

        listday.clear();
        for (SelectItem selectItem : list) {
            Boolean check = true;
            System.out.println("D:-- listS100: " + listS100.size());
            for (S100 s100 : listS100) {
                if (s100.getSn101() == Integer.parseInt(selectItem.getValue().toString())) {
                    if (s100.getSn104() == 1) {
                        check = false;
                        break;
                    }
                }
            }
            if (check) {
                listday.add(selectItem);
            }
        }

        return listday;
    }

    /**
     * @param listday the listday to set
     */
    public void setListday(List<SelectItem> listday) {

        this.listday = listday;
    }

    /**
     * @return the selectid
     */
    public int getSelectid() {
        Object obj = SessionProvider.getSessionMapValue("selectidS100");
        if (obj != null) {
            try {
                selectid = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }

        }
        return selectid;
    }

    /**
     * @param selectid the selectid to set
     */
    public void setSelectid(int selectid) {
        this.selectid = selectid;
    }

    /**
     * @return the listdayedit
     */
    public List<SelectItem> getListdayedit() {
        SelectItem item = new SelectItem();
        System.out.println("D:---- selectid : " + getSelectid());
        switch (getSelectid()) {
            case 1:
                item.setLabel("Chủ nhật");
                item.setValue("1");
                break;
            case 2:
                item.setLabel("Thứ Hai");
                item.setValue("2");
                break;
            case 3:
                item.setLabel("Thứ Ba");
                item.setValue("3");
                break;
            case 4:
                item.setLabel("Thứ Tư");
                item.setValue("4");
                break;
            case 5:
                item.setLabel("Thứ Năm");
                item.setValue("5");
                break;
            case 6:
                item.setLabel("Thứ Sáu");
                item.setValue("6");
                break;
            case 7:
                item.setLabel("Thứ Bảy");
                item.setValue("7");
                break;

        }
        List<SelectItem> list = new ArrayList<SelectItem>();
        SelectItem t2 = new SelectItem("2", "Thứ Hai");
        list.add(t2);
        SelectItem t3 = new SelectItem("3", "Thứ Ba");
        list.add(t3);
        SelectItem t4 = new SelectItem("4", "Thứ Tư");
        list.add(t4);
        SelectItem t5 = new SelectItem("5", "Thứ Năm");
        list.add(t5);
        SelectItem t6 = new SelectItem("6", "Thứ Sáu");
        list.add(t6);
        SelectItem t7 = new SelectItem("7", "Thứ Bảy");
        list.add(t7);
        SelectItem cn = new SelectItem("1", "Chủ nhật");
        list.add(cn);


        for (SelectItem selectItem : list) {
            Boolean check = true;
            System.out.println("D:-- listS100: " + listS100.size());
            for (S100 s100 : listS100) {
                if (s100.getSn101() == Integer.parseInt(selectItem.getValue().toString())) {
                    check = false;
                    break;
                }
            }
            if (check) {
                listdayedit.add(selectItem);
            }
        }
        if (item != null) {
            listdayedit.add(item);
        }
        return listdayedit;
    }

    /**
     * @param listdayedit the listdayedit to set
     */
    public void setListdayedit(List<SelectItem> listdayedit) {
        this.listdayedit = listdayedit;
    }

    /**
     * @return the vn079
     */
    public int getVn079() {
        return vn079;
    }

    /**
     * @param vn079 the vn079 to set
     */
    public void setVn079(int vn079) {
        this.vn079 = vn079;
    }

    /**
     * @return the n750
     */
    public int getN750() {
        return n750;
    }

    /**
     * @param n750 the n750 to set
     */
    public void setN750(int n750) {
        this.n750 = n750;
    }

    /**
     * @return the cbxA000TTP
     */
    public List<SelectItem> getCbxA000TTP() {
        ComboboxUtil com = new ComboboxUtil();
        if (SessionProvider.getSessionMapValue("n750ProTP") != null) {
            cbxA000TTP = com.getListCombA000DV(Util.parseInt(SessionProvider.getSessionMapValue("n750ProTP")));

        } else {
            cbxA000TTP = com.getListCombA000DV(0);
        }
        System.out.println("-------AAAAAAAAAAAA---------" + cbxA000TTP.size());
        return cbxA000TTP;
    }

    /**
     * @param cbxA000TTP the cbxA000TTP to set
     */
    public void setCbxA000TTP(List<SelectItem> cbxA000TTP) {
        this.cbxA000TTP = cbxA000TTP;
    }

    /**
     * @return the combN750TP
     */
    public List<SelectItem> getCombN750TP() {
        ComboboxUtil com = new ComboboxUtil();

        combN750TP = com.getlistCombN750DVT();


        return combN750TP;
    }

    /**
     * @param combN750TP the combN750TP to set
     */
    public void setCombN750TP(List<SelectItem> combN750TP) {
        this.combN750TP = combN750TP;
    }

    /**
     * @return the idcountry
     */
    public int getIdcountry() {
        return idcountry;
    }

    /**
     * @param idcountry the idcountry to set
     */
    public void setIdcountry(int idcountry) {
        this.idcountry = idcountry;
    }
}
